<me:UIKDANSP x:Class="WPFExcelReport.TKD14"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                     xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM" 
                    xmlns:me="clr-namespace:WPFExcelReport"  
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                     FontSize="14"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIKDANSP.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIKDANSP.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <WrapPanel>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                    <KD:TSKD02 KEY="{Binding KUNDNR,ElementName=TV}"
                               />
                    <Grid Margin="10,0,0,0" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=姓名:}}"></TextBlock>
                        <ex:TXT72   MaxLength="8" Grid.Column="1" CharacterCasing="Upper"   
                                Text="{Binding NNAME,ElementName=TV,Converter={StaticResource gb2312}}" Width="Auto"  MinWidth="80" />
                    </Grid>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                </WrapPanel>
            </WrapPanel> 
            <me:TKD14S Grid.Row="0" 
                    x:Name="c14S" 
                    ORDERNUM="{Binding KEY,ElementName=TV}"
                     KEY="{Binding ORDERNUM,ElementName=TV}"
                     IsEdit="{Binding IsEdit,ElementName=TV}"
                     IsSaved="{Binding IsSaved,ElementName=TV}"
                   />
        </StackPanel>
        <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster" 
                   IsReadOnly="True"
                   RowDetailsVisibilityMode="Visible"  
                   MaxHeight="400"
                >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=KDSANSPNA,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=姓名}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=KDSTEL}" Header="{Binding Source={Localization:Translate Word=电话}}"  Width="Auto" />
                 <DataGridTextColumn Binding="{Binding Path=KDSMAILADR,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=邮件}}"  Width="100" />     
                <DataGridTextColumn Binding="{Binding Path=KDSFAX}" Header="{Binding Source={Localization:Translate Word=传真}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIKDANSP>
